home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Utilities Professional 1-1500
/
Utilities Professional 1-1500 (1994)(WPD)[!].iso
/
07511000
/
var0888.dms
/
var0888.adf
/
WoManD
/
man
/
C_Library
/
fopen
< prev
next >
Wrap
Text File
|
1992-09-19
|
2KB
|
58 lines
FOPEN(1) C LIBRARY FUNCTIONS FOPEN(1)
NAME
fopen, freopen - to open a stream
SYNOPSIS
FILE *fopen(char *filename,char *type);
FILE *freopen(char *filename,char *type,FILE *stream);
INCLUDE FILE
stdio.h
DESCRIPTION
fopen() opens the file named by filename and associates a stream with
it. If the open succeeds, fopen() returns a pointer to be used to
identify the stream in subsequent operations.
-filename points to a character string that contains the name of
the file to be opened.
-type is a character string having one of the following values:
r open for reading
w truncate or create for writing
a append: open for writing at end of file, or create for
writing
r+ open for update (reading and writing)
w+ truncate or create for update (read and write).
a+ append; open or create for update at EOF
a 'b' can also be added to these mode to signify that the file is
a binary file. For example: "r+b" or "rb+".
When a file is open for both reading and writing a call to fflush()
or to one of fseek(), fsetpos() or rewind() must be performed
between a read and a write.
freopen() opens the file named by filename and associates the stream
pointed to by stream with it. The type argument is used just as
in fopen(). The original stream is closed, regardless of whether
the open ultimately succeeds. If the open succeeds, freopen()
returns the original value of stream. If it fails, it returns NULL.
freopen() is typically used to redirect to files the preopened streams
associated with stdin, stdout, and stderr.
RETURN VALUES
On success, fopen(), and freopen() return a pointer to FILE which
identifies the opened stream. On failure, they return NULL.
SEE ALSO
fclose(), fflush().